%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ft=erlang ts=4 sw=4 et
{sys, [
       {lib_dirs, ["../apps", "../deps", "../plugins"]},
       {erts, [{mod_cond, derived}, {app_file, strip}]},
       {app_file, strip},
       {rel, "emqttd", "0.8.2",
        [
         kernel,
         stdlib,
         sasl,
         asn1,
		 syntax_tools,
		 ssl,
		 crypto,
         %mnesia,
         eldap,
         xmerl,
		 os_mon,
		 inets,
		 goldrush,
         compiler,
		 lager,
         {gen_logger, load},
         gproc,
		 esockd,
		 mochiweb,
         {emqtt, load},
         emqttd
        ]},
       {rel, "start_clean", "",
        [
         kernel,
         stdlib
        ]},
       {boot_rel, "emqttd"},
       {profile, embedded},
       {incl_cond, exclude},
       %{mod_cond, derived},
       {excl_archive_filters, [".*"]}, %% Do not archive built libs
       {excl_sys_filters, ["^bin/(?!start_clean.boot)",
                           "^erts.*/bin/(dialyzer|typer)",
                           "^erts.*/(doc|info|include|lib|man|src)"]},
       {excl_app_filters, ["\.gitignore"]},
       {app, kernel, [{incl_cond, include}]},
       {app, stdlib, [{incl_cond, include}]},
       {app, sasl, [{incl_cond, include}]},
       {app, asn1, [{incl_cond, include}]},
       {app, crypto, [{incl_cond, include}]},
       {app, ssl, [{incl_cond, include}]},
       {app, xmerl, [{incl_cond, include}]},
       {app, os_mon, [{incl_cond, include}]},
       {app, syntax_tools, [{incl_cond, include}]},
       {app, public_key, [{incl_cond, include}]},
       {app, mnesia, [{incl_cond, include}]},
       {app, eldap, [{incl_cond, include}]},
       {app, inets, [{incl_cond, include}]},
       {app, compiler, [{incl_cond, include}]},
       {app, goldrush, [{incl_cond, include}]},
       {app, gen_logger, [{incl_cond, include}]},
       {app, lager, [{incl_cond, include}]},
       {app, gproc, [{incl_cond, include}]},
       {app, esockd, [{mod_cond, app}, {incl_cond, include}]},
       {app, mochiweb, [{mod_cond, app}, {incl_cond, include}]},
       {app, emqtt, [{mod_cond, app}, {incl_cond, include}]},
       {app, emqttd, [{mod_cond, app}, {incl_cond, include}]}
      ]}.

{target_dir, "emqttd"}.

{overlay_vars, "vars.config"}.

{overlay, [
           {mkdir, "log/"},
           {mkdir, "etc/"},
           {mkdir, "etc/ssl/"},
           {mkdir, "data/"},
           {mkdir, "plugins/"},
           {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
           {template, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},
           {template, "files/emqttd", "bin/emqttd"},
           {template, "files/emqttd_ctl", "bin/emqttd_ctl"},
           {template, "files/emqttd.cmd", "bin/emqttd.cmd"},
           {copy, "files/start_erl.cmd", "bin/start_erl.cmd"},
           {copy, "files/install_upgrade.escript", "bin/install_upgrade.escript"},
           {copy, "files/ssl/ssl.crt", "etc/ssl/ssl.crt"},
           {copy, "files/ssl/ssl.key", "etc/ssl/ssl.key"},
           {template, "files/emqttd.config", "etc/emqttd.config"},
           {template, "files/acl.config", "etc/acl.config"},
           {template, "files/rewrite.config", "etc/rewrite.config"},
           {template, "files/clients.config", "etc/clients.config"},
           {template, "files/plugins.config", "etc/plugins.config"},
           {template, "files/vm.args", "etc/vm.args"}
          ]}.
